var arr = new Array();
var arr1 = new Array();
for(var i=0;i<5;i++){
    arr[i] = i;
}
for(var i=9;i>=0;i--){
    arr1[i] = i;
}
console.time("rub.js time");
var rub=new Rub({
    el:'app',
    debug:1,
    template:Rub.getTemplate('tempid'),
    data:{
        inputVal:'0',
        checkedArr:['1','3'],
        checked:true,
        picked:'One',
        selected:'',
        selected3:'C',
        cartImg:'',
        options:[{text:'apple',value:'A'},
            {text:'sydney',value:'B'},
            {text:'apple',value:'C'},
        ],
        selected1:'C',
        tvalue:'好东西',
        className1:'red',
        className2:'small',
        newName:'1',
        name:'小明',
        age:18,
        color:'green',
        birthday:'1991/01/01',
        step:3,
        father:{
            name:'小明他爸',
            age:45,
            father:{
                bbb:null,
                name:'小明的爷爷',
                age:76
            }
        },
        selected2:[],
        arr:arr,
        arr1:[4,5,6],
        arr2:[{name:'好'},{name:'好1'},{name:'好2'},{name:'好3'},{name:'好4'},{name:'好5'},{name:'好6'}],
        arr3:[{name:'1'},{name:'2'},{name:'3'},{name:4},{name:5},{name:6}]
    },
    calc:{
        className3(){
            return 'yellow'
        },
        relationship1(){
            return this.data.name+"的爸爸"
        },
        relationshi2(){
            return this.data.name+"的爷爷"
        },
        styleObj(){
            return {
                color:'red',
                'font-size':'16px'
            }
        },
        styleObj1(){
            return {
                'background-color':'black'
            }
        }
    },
    watcher:{
        'data.arr'(newVlue,value){
            console.log("属性变化----------:",newVlue,value)
        },
        'data.father'(newVlue,value){

            console.log("属性变化----------:",newVlue,value)
        },
        'data.father.father.age'(newVlue,value){
            console.log("属性变化----------:",newVlue,value)
        }
    },
    beforeUpdate(vdom){
       
    },
    create(){
        // console.log(this['arr'])
    },
    ready(){
        setTimeout(() => {
            this.data.cartImg='http://t2.hddhhn.com/uploads/tu/201610/198/scx30045vxd.jpg'
            this.data.arr[1]=99
        }, 2000);
        
    },
    method:{
        getBlur(e){
           
        },
        changeColor(){

            if(this.data.className1=='red'){
                this.data.className1='blue'
                this.data.className2='big'
            }else{
                this.data.className1='red'
                this.data.className2='small'
            }
        },
        changeNum(){
            // this.data.arr[8]=2
            // this.data.arr.splice(1,1)
            // this.data.arr=[1,1,1,1,2,1]
            if(this.data.arr.length<5)
                this.data.arr=[1,1,1,1,2,1]
            else{
                this.data.arr.splice(1,1)
            }
        },
        canIchange(num,e){
            // console.log("````````````````````````````````",num)
            if(typeof num=='object')num=1
            // this.data.age+=num;
            // this.data.father.age+=num;
            this.data.father.father.age+=num;
            setTimeout(() => {
                this.data.father=null;
            }, 2000);
            setTimeout(() => {
                this.data.father={
                    name:'小明他爸神经病',
                    age:50,
                    father:{
                        bbb:null,
                        name:'小明的爷爷',
                        age:80
                    }
                }
            }, 4000);
            
            setTimeout(() => {
                this.data.father.father.age+=num;
            }, 6000);
        }
    }
})
console.timeEnd("rub.js time");